﻿using System.Collections.Generic;
using System.Linq;
using WalkingTec.Mvvm.Core;
using SelfService.Model.Models;


namespace SelfService.ViewModel.SysConfigGroupVMs
{
    public partial class SysConfigGroupListVm : BasePagedListVM<SysConfigGroupView, SysConfigGroupSearcher>
    {

        protected override IEnumerable<IGridColumn<SysConfigGroupView>> InitGridHeader()
        {
            return new List<GridColumn<SysConfigGroupView>>{
                this.MakeGridHeader(x => x.Name),
                this.MakeGridHeader(x => x.Key),
                this.MakeGridHeader(x => x.Description),
                this.MakeGridHeaderAction(width: 200)
            };
        }

        public override IOrderedQueryable<SysConfigGroupView> GetSearchQuery()
        {
            var query = DC.Set<SysConfigGroup>()
                .Select(x => new SysConfigGroupView
                {
				    ID = x.ID,
                    Name = x.Name,
                    Key = x.Key,
                    Description = x.Description,
                })
                .OrderBy(x => x.ID);
            return query;
        }

    }

    public class SysConfigGroupView : SysConfigGroup{

    }
}
